package com.legrand.www.module.exception.exception;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author xiah
 * @date 2018/4/26 13:58
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class ExceptionBase extends RuntimeException {
    private Integer code;
    private String message;

    public ExceptionBase(Integer code, String message) {

        this.code = code;
        this.message = message;

    }

    public ExceptionBase(Integer code) {
        String content = ExceptionEnum.getName(code);
        if (content == null) {
            content = "没有定义的异常";
        }
        this.message = content;
    }

    @Override
    public synchronized Throwable fillInStackTrace() {
        return this;
    }
}
